<template>
    <div class="attributes-container" :style="{ backgroundColor: backgroundColor }">
      <div
        v-for="(attr, index) in attributes"
        :key="index"
        class="attribute-item"
        :style="{ width: attr.width }"
      >
        <div class="content">
          <!-- 属性名 -->
          <div class="attribute-name" :style="{ fontSize: nameFontSize + 'px' }">
            {{ attr.name }}
          </div>
  
          <!-- 属性值（支持Logo） -->
          <div class="attribute-value" :style="{ fontSize: valueFontSize + 'px' }">
            <!-- LOGO 图标 -->
            <img v-if="attr.logo" :src="attr.logo" alt="logo" class="value-logo" />
            <!-- 值文本 -->
            <span>{{ attr.value }}</span>
          </div>
        </div>
  
        <!-- 显示竖线，除了最后一个 -->
        <div
          v-if="index < attributes.length - 1"
          class="vertical-divider"
        ></div>
      </div>
    </div>
  </template>
  
  <script setup>
  
  defineProps({
    // 属性列表
    attributes: {
      type: Array,
      required: true
    },
    // 属性名字号
    nameFontSize: {
      type: [Number, String],
      default: 14
    },
    // 属性值字号
    valueFontSize: {
      type: [Number, String],
      default: 16
    },
    // 背景色
    backgroundColor: {
      type: String,
      default: '#f9f9f9'
    }
  });
  </script>
  
  <style scoped>
  .attributes-container {
    display: flex;
    align-items: flex-start;
    width: 100%;
    padding: 20px;
    box-sizing: border-box;
    font-family: Arial, sans-serif;
    background-color: #f9f9f9; /* 默认背景色 */
    min-height: 80px;
    flex-wrap: wrap;
  }
  
  .attribute-item {
    display: flex;
    flex-direction: column;
    justify-content: flex-start;
    position: relative;
    box-sizing: border-box;
    padding: 0 10px 0 15px;
    min-width: 100px;
    flex-shrink: 0;
  }
  
  .content {
    text-align: left;
  }
  
  /* 属性名样式 */
  .attribute-name {
    font-weight: normal;
    color: #333;
    margin-bottom: 4px;
    font-family: SimHei, sans-serif; /* 黑体 */
  }
  
  /* 属性值样式 */
  .attribute-value {
    color: #000;
    display: flex;
    align-items: center;
    gap: 6px;
  }
  
  /* LOGO 样式 */
  .value-logo {
    width: 16px;
    height: 16px;
    vertical-align: middle;
  }
  
  /* 竖线分割线 */
  .vertical-divider {
    position: absolute;
    top: 0;
    right: 0;
    bottom: 0;
    width: 1px;
    background-color: #ccc; /* 灰色竖线 */
  }
  </style>